from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.globals import CurrentConfig, NotebookType
# 切换为离线模式
CurrentConfig.ONLINE_HOST = "https://assets.pyecharts.org/assets/"

# 创建柱状图
bar = (
    Bar()
    .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    .set_global_opts(title_opts=opts.TitleOpts(title="商品销售情况", subtitle="示例数据"))
)

# 渲染为 HTML 文件
bar.render("bar_chart.html")